package bug.dao.hibernate;

import bug.dao.api.UserDao;
import bug.persistent.Bug;
import bug.persistent.User;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * User: ion
 * Date: Aug 30, 2008 - 7:08:50 PM
 */

public class UserDaoHibernate extends BaseDaoHibernate<User> implements UserDao {

    @Override
    @Transactional(propagation= Propagation.NOT_SUPPORTED)
    public Class<User> domainClass() {
        return User.class;
    }

    public List<Bug> loadBugs(Long userId) {
        return getHibernateTemplate().find("from Bug b where b.user.id = ?", new Object[] {userId});
    }
}